
#ifndef OGREAPPLICATION_H
#define OGREAPPLICATION_H


#include "PhysicHandler.h"
#include "KeyboardMouseHandler.h"
#include "SoundHandler.h"
#include "MenuHandler.h"

class OgreApplication {
	
	//Attribute

		//general

		OgreInitializeSettings* ogre_init_settings;
		bool end_mainloop;

		Ogre::Root*					lRoot;
		Ogre::SceneManager*			lSceneManager;
		Ogre::RenderWindow*			lWindow;
		Ogre::ResourceGroupManager* lResourceGroupManager;
		Ogre::MaterialManager*		lMaterialManager;
		

		//handler

		PhysicHandler* gPhysichandler;
		KeyboardMouseHandler* gkeymousehandler;
		SoundHandler* gSoundhandler;
		MenuHandler* gMenuHandler;

	//Methoden
		
	public:	

		static float soundtest_velocity;

		OgreApplication();
		OgreApplication(OgreInitializeSettings* initsets);
		
		~OgreApplication();
		
		//get_methods
		
		OgreInitializeSettings* getInitSettings();
		Ogre::RenderWindow* getMainWindow();
		Ogre::ResourceGroupManager* getResourceGroupManager();
		PhysicHandler* getPhysicHandler();
		Ogre::SceneManager* getSceneManager();
		KeyboardMouseHandler* getKeyboardMouseHandler();
		SoundHandler* getSoundHandler();
		MenuHandler* getMenuHandler();

		//init_methods

		void init();

		//progress_methods

		void MainLoopManualAbort();
		void startMainLoop();
		
		void MainLoopGap1(unsigned long etime);
		void MainLoopGap2(unsigned long etime);
		void MainLoopGap3(unsigned long etime);

		//player_methods

		Ogre::Camera* createStdPlayerCam();

		//physic_methods

		 

	private:
		
		//init_methods

		void initNull();
		void initOgreBasic();
		void initPhysics();
		void initInputs();
		void initSoundSystem();
		void initMenuHandler();
		void initTerrain();

		//destroy_methods

		void destroyOgreBasic();
		void destroyPhysics();
		void destroyKeyboardMouseHandler();
		void destroySoundHandler();
		void destroyMenuHandler();
		void destroyTerrain();

		//progress_methods

		void main_loop();
		bool MainLoopCloseCondition();
		void initStartScene();

	};


#endif